﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.Entity.Validation;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics;
using System.Web.Mvc;

namespace PIB.Models
{
    public partial class Vak
     {
        private PIBDataModelContainer db = new PIBDataModelContainer();

        public List<Vak> Index()
        {
            return db.VakSet.ToList();
        }

        public Vak Details(int id)
        {
            return db.VakSet.Find(id);
        }

        public void Create(Vak vak)
        {
            db.VakSet.Add(vak);
            db.SaveChanges();
        }

        public Vak Edit(int id)
        {
            return db.VakSet.Find(id);
        }

        public void Edit(Vak vak)
        {
            db.Entry(vak).State = EntityState.Modified;
            db.SaveChanges();
        }

        public void Delete(int id)
        {
            db.VakSet.Find(id);
        }

        public void DeleteConfirmed(int id)
        {

            Vak vak = db.VakSet.Find(id);
            db.VakSet.Remove(vak);
            db.SaveChanges();
        }

        public void Dispose(bool disposing)
        {
            db.Dispose();

        }
     }
}